package liuyuyang.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import liuyuyang.domain.StudentCourse;
import liuyuyang.pojo.Result;
import liuyuyang.service.StudentCourseService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/sc")
public class StudentCourseController {
    @Resource
    private StudentCourseService studentCourseService;

    @DeleteMapping("/{id}")
    public Result<String> del(@PathVariable Integer id) {
        String result = studentCourseService.removeById(id) ? "删除成功" : "删除失败";
        return Result.success(result);
    }

    @PostMapping
    public Result<String> add(@RequestBody StudentCourse studentCourse) {
        String result = studentCourseService.save(studentCourse) ? "新增成功" : "新增失败";
        return Result.success(result);
    }
}
